/**
 *	api目录下的控制器，需要验证单位
 *	开发者：雨中磐石
 *	地址：www.rockoa.com
 *	日期：2023-07-29
 */
package com.framework.Controller.api;


import com.framerock.server.Response;
import com.framerock.baselib.Rock;

import java.util.Map;

public class ControllerApiCompany extends ControllerApi {


    public String checkCompany()
    {
        if(!mRequest.COMPANYBOOL)return Response.returnError("必须选择一个单位下操作","203");
        Map<String,String> ars = mRequest.getUserainfo();
        if(ars == null)return Response.returnError("你不在("+mRequest.getCompanyrs("name")+")单位里无法操作");
        int zt      = Rock.getMapint(ars, "status");
        int state   = Rock.getMapint(ars, "state");
        if(zt==0)return Response.returnError("此单位用户已停用");
        if(state==0)return Response.returnError("此单位用户未激活，请先激活");
        if(state==3)return Response.returnError("此单位用户已离职");
        if(state==2)return Response.returnError("此单位用户主动退出");
        return "";
    }
}
